import request from '@/utils/request'
import  { uaaUrl }  from '@/utils/request'

// 查询字典类型列表
export function listType(query,url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/v1/sysDictType/sysDictTypeListPage',
    method: 'get',
    params: query
  })
}
// 查询服务列表
export function getService() {
  return request({
    url: uaaUrl()+'api-system/v1/sysDictType/sysDictUrl',
    method: 'get'
  })
}
// 查询字典类型详细
export function getType(baseId,url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/v1/sysDictType/' + baseId,
    method: 'get'
  })
}

// 新增字典类型
export function addType(data,url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/v1/sysDictType',
    method: 'post',
    data: data
  })
}

// 修改字典类型
export function updateType(data,url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/v1/sysDictType',
    method: 'put',
    data: data
  })
}

// 删除字典类型
export function delType(dictId,url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/v1/sysDictType/' + dictId,
    method: 'delete'
  })
}

// 刷新字典缓存
export function refreshCache() {
  return request({
    url: '/system/dict/type/refreshCache',
    method: 'delete'
  })
}

// 获取字典选择框列表
export function optionselect(url) {
  return request({
    url: (url?uaaUrl()+url:'')+'/system/dict/type/optionselect',
    method: 'get'
  })
}
